import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:gourmet/color/hex.dart';
import 'package:gourmet/extensions/ex_widget.dart';
import 'package:gourmet/ui/draw_under_line.dart';
import 'package:gourmet/utils/colors.dart';
import 'package:gourmet/utils/styles.dart';
import 'package:gourmet/utils/tools.dart';

class RecruitPlaceController extends GetxController {
  late TextEditingController textEditingController;

  @override
  void onInit() {
    textEditingController = ToolsUtils.editingController('大润发');
    super.onInit();
  }

  @override
  void onClose() {
    textEditingController.dispose();
    super.onClose();
  }
}

class RecruitPlacePage extends GetView<RecruitPlaceController> {
  const RecruitPlacePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        backgroundColor: Colors.white,
        systemOverlayStyle: SystemUiOverlayStyle.dark,
        leading: IconButton(
          onPressed: Get.back,
          icon: Icon(
            CupertinoIcons.chevron_back,
            size: 20,
            color: HexColor(ColorsUtils.color0000),
          ),
        ),
        centerTitle: true,
        title: Text(
          '意向工作地点',
          style: StylesUtils.customTextStyle(
            fontSize: StylesUtils.fontSize16,
            fontWeight: FontWeight.w700,
            color: ColorsUtils.color0000,
          ),
        ),
        bottom: PreferredSize(
          preferredSize: const Size.fromHeight(40),
          child: Container(
            alignment: Alignment.center,
            child: TextField(
              cursorHeight: 20,
              cursorWidth: 3,
              cursorRadius: const Radius.circular(2),
              controller: controller.textEditingController,
              cursorColor: HexColor(ColorsUtils.colorFf64),
              style: StylesUtils.customTextStyle(
                fontSize: StylesUtils.fontSize15,
                color: ColorsUtils.color0000,
              ),
              textAlign: TextAlign.left,
              textAlignVertical: TextAlignVertical.center,
              textDirection: TextDirection.ltr,
              decoration: InputDecoration(
                hintText: '请输入地址',
                hintStyle: StylesUtils.customTextStyle(
                  fontSize: StylesUtils.fontSize15,
                  color: ColorsUtils.color9999,
                ),
                filled: true,
                fillColor: HexColor(ColorsUtils.colorF7f7),
                isDense: true,
                isCollapsed: true,
                contentPadding:
                    const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
                suffixIcon: Center(
                  child: Icon(
                    CupertinoIcons.multiply_circle_fill,
                    size: 20,
                    color: HexColor(ColorsUtils.color9999),
                  ),
                ).onTap(() {}),
                suffixIconConstraints:
                    const BoxConstraints.expand(width: 40, height: 30),
                enabledBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(18),
                  borderSide: BorderSide.none,
                ),
                focusedBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(18),
                  borderSide: BorderSide.none,
                ),
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(18),
                  borderSide: BorderSide.none,
                ),
                constraints:
                    const BoxConstraints.expand(width: 345, height: 35),
              ),
            ),
          ),
        ),
      ),
      body: ListView(
        padding: const EdgeInsets.symmetric(horizontal: 10),
        children: [
          DrawUnderLine(
            child: Column(
              children: [
                Container(
                  padding: const EdgeInsets.only(top: 15, bottom: 10),
                  alignment: Alignment.centerLeft,
                  child: Text.rich(
                    TextSpan(
                      children: [
                        TextSpan(
                          text: '大润发',
                          style: StylesUtils.customTextStyle(
                            fontSize: StylesUtils.fontSize15,
                            color: ColorsUtils.color0000,
                          ),
                        ),
                        TextSpan(
                          text: '投资有限公司(乐百佳店)',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999,
                            fontSize: StylesUtils.fontSize15,
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(bottom: 20),
                  alignment: Alignment.centerLeft,
                  child: Text(
                    '广西壮族自治区北海市海城区',
                    style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color9999,
                      fontSize: StylesUtils.fontSize13,
                    ),
                  ),
                )
              ],
            ),
          ),
          DrawUnderLine(
            child: Column(
              children: [
                Container(
                  padding: const EdgeInsets.only(top: 15, bottom: 10),
                  alignment: Alignment.centerLeft,
                  child: Text.rich(
                    TextSpan(
                      children: [
                        TextSpan(
                          text: '大润发',
                          style: StylesUtils.customTextStyle(
                            fontSize: StylesUtils.fontSize15,
                            color: ColorsUtils.color0000,
                          ),
                        ),
                        TextSpan(
                          text: '投资有限公司(乐百佳店)',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999,
                            fontSize: StylesUtils.fontSize15,
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(bottom: 20),
                  alignment: Alignment.centerLeft,
                  child: Text(
                    '广西壮族自治区北海市银海区民治街道民治大道328号嘉熙业广场',
                    style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color9999,
                      fontSize: StylesUtils.fontSize13,
                    ),
                  ),
                )
              ],
            ),
          ),
          DrawUnderLine(
            child: Column(
              children: [
                Container(
                  padding: const EdgeInsets.only(top: 15, bottom: 10),
                  alignment: Alignment.centerLeft,
                  child: Text.rich(
                    TextSpan(
                      children: [
                        TextSpan(
                          text: '大润发',
                          style: StylesUtils.customTextStyle(
                            fontSize: StylesUtils.fontSize15,
                            color: ColorsUtils.color0000,
                          ),
                        ),
                        TextSpan(
                          text: '投资有限公司(乐百佳店)',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999,
                            fontSize: StylesUtils.fontSize15,
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(bottom: 20),
                  alignment: Alignment.centerLeft,
                  child: Text(
                    '广西壮族自治区北海市合浦县解放街道和平东路富联华商贸中心',
                    style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color9999,
                      fontSize: StylesUtils.fontSize13,
                    ),
                  ),
                )
              ],
            ),
          ),
          DrawUnderLine(
            child: Column(
              children: [
                Container(
                  padding: const EdgeInsets.only(top: 15, bottom: 10),
                  alignment: Alignment.centerLeft,
                  child: Text.rich(
                    TextSpan(
                      children: [
                        TextSpan(
                          text: '大润发',
                          style: StylesUtils.customTextStyle(
                            fontSize: StylesUtils.fontSize15,
                            color: ColorsUtils.color0000,
                          ),
                        ),
                        TextSpan(
                          text: '投资有限公司(乐百佳店)',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999,
                            fontSize: StylesUtils.fontSize15,
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(bottom: 20),
                  alignment: Alignment.centerLeft,
                  child: Text(
                    '广西壮族自治区北海市铁山港区南邻街道葵新北路58号葵涌商贸城',
                    style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color9999,
                      fontSize: StylesUtils.fontSize13,
                    ),
                  ),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
